import java.util.*;

public class NeighbouringNumbers {
    public static void main(String[] args) {
        Scanner keybordInput = new Scanner(System.in);
        System.out.print("Input leangth of array: ");
        int arrayLength = keybordInput.nextInt();
        if (arrayLength < 2 ) {
            System.out.print("Length of array must be more than 1");
            return;
        }
        int [] analyzeArray = new int[arrayLength];
        
        System.out.println("Input elements of array:");
        for (int arrayIndex = 0; arrayIndex<analyzeArray.length; arrayIndex++) {
            analyzeArray[arrayIndex] = keybordInput.nextInt();
        }
        
        int firstIndexOfMinDistance = 0;
        int minDistance = Math.abs(analyzeArray[0] - analyzeArray[1]) ;
        
        for (int arrayIndex = 1; arrayIndex<analyzeArray.length-1; arrayIndex++) {
            if(Math.abs(analyzeArray[arrayIndex] - analyzeArray[arrayIndex+1]) < minDistance) {
                minDistance = Math.abs(analyzeArray[arrayIndex] - analyzeArray[arrayIndex+1]);
                firstIndexOfMinDistance = arrayIndex;
            }
        }
        
        System.out.println("index = "+ firstIndexOfMinDistance);
    }
}